package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.tMesProQualityPojo;
import com.example.pojo.tMesProStationDataPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface tMesProStationDataMapp {
    //多条件查询过站数据
    @DS("newMscLowCodeFormal")
    @Select("<script>" +
            "SELECT * FROM T_MES_PRO_STATION_DATA " +
            "WHERE 1=1 " +  // 默认条件，避免后续空条件时出错
            "<if test='engineNumber != null and engineNumber != \"\"'> AND F_RECORD_ID = #{engineNumber} </if>" +
            "<if test='stationId != null and stationId != \"\"'> AND F_STATION_ID = #{stationId} </if>" +
            "<if test='timeStart != null and timeEnd != null and timeStart != \"\" and timeEnd != \"\"'> " +
            "AND F_BEGIN_TIME BETWEEN #{timeStart} AND #{timeEnd} " +
            "</if>" +
            "ORDER BY F_BEGIN_TIME ASC " +
            "</script>")

    List<tMesProStationDataPojo> queryMultipleConditions(String engineNumber, String stationId, String timeStart, String timeEnd);
}
